package com.mini.repository;

import com.mini.model.BusinessPlanSitePageR;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @description: 计划站点页面关系表
 */
@Repository
public interface BusinessPlanPageSiteRRepository extends JpaRepository<BusinessPlanSitePageR, Long>, JpaSpecificationExecutor<BusinessPlanSitePageR> {
    BusinessPlanSitePageR findByPlanSite(Long planSite);
    BusinessPlanSitePageR findByPlanName(String planName);

    @Query(value = "select * from business_plan_site_page_r where  lesson_site = ?1 order by update_time desc", nativeQuery = true)
    List<BusinessPlanSitePageR> findAllByLessonSite(Long lessonSite);

    @Query(value = "select * from business_plan_site_page_r where  lesson_site in ?1", nativeQuery = true)
    List<BusinessPlanSitePageR> findByLessonSiteIn(List<Long> lessonSiteList);

    List<BusinessPlanSitePageR> findAllByNextDayLessonSite(Long nextDayLessonSite);
}
